// license-header java merge-point
package edu.uoc.tfc.gui.parts.tancar;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionMapping;

import edu.uoc.tfc.gui.common.Level;
import edu.uoc.tfc.gui.common.MissatgeAjax;
import edu.uoc.tfc.gui.common.ResultatAccioAjaxVO;

/**
 * @see edu.uoc.tfc.gui.parts.tancar.TancaPartController
 */
public class TancaPartControllerImpl extends TancaPartController
{
    /**
     * @see edu.uoc.tfc.gui.parts.tancar.TancaPartController#tancaPart(org.apache.struts.action.ActionMapping, edu.uoc.tfc.gui.parts.tancar.TancaPartForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public final void tancaPart(ActionMapping mapping, edu.uoc.tfc.gui.parts.tancar.TancaPartForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {

    	getPartService().tancarPart(
    			form.getPart());
    								
		MissatgeAjax missatge = new MissatgeAjax("cu.tancaPart.success", null, Level.Success);
		ResultatAccioAjaxVO resultat = new ResultatAccioAjaxVO();
		resultat.addMessage(missatge);
		form.setResultat(resultat);      	    		
    }

    /**
     * @see edu.uoc.tfc.gui.parts.tancar.TancaPartController#consultaPart(org.apache.struts.action.ActionMapping, edu.uoc.tfc.gui.parts.tancar.ConsultaPartForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
     */
    public final void consultaPart(ActionMapping mapping, edu.uoc.tfc.gui.parts.tancar.ConsultaPartForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
    	form.setPart(
    			getPartService().getPart(form.getId()));
    }

}